package com.itstyle.seckill.topic.desinger.design_cj.factory.basicfactory;

/**
 * @Auther: liuwenxiang
 * @Date: 2020/3/11 12:27
 * @Description:
 */
public class Factory {

    public static Sender createProduct(String type){
        Sender sender=null;
        switch (type){
            case "a":
                sender = (Sender) new SmsSender();
                break;
            case "b":
                sender = (Sender)  new MailSender();
                break;
        }
        return  sender;
    }

    public static void main(String[] args) {
        Sender sender =  Factory.createProduct("a");
        sender.send();
    }
}
